package com.ds.lens.data.service.metric;

import com.ds.lens.data.common.asserts.Asserts;
import com.ds.lens.data.common.constant.Constants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Description:
 *
 * @author WeiShaoying
 * @date 2019-12-24
 */
@Component
public class MetricQueryFactory {
    @Autowired
    Map<String, MetricQueryService> map = new ConcurrentHashMap<>();

    public MetricQueryService getMetricQueryService(String key) {
        MetricQueryService metricQueryService = map.get(key);
        Asserts.assertNotNull(metricQueryService, Constants.ErrorCode.NO_INSTANCE_EXCEPTION);
        return metricQueryService;
    }

}
